#include<stdio.h>
#include<unistd.h>
#include<pthread.h>
/*

 *
 */

void * func(void * arg){
	//方式二：在子线程中调
	//pthread_detach(pthread_self());
	printf("This is child thread\n");
	sleep(20);
	pthread_exit("thread return");
}

int main(){
	pthread_t tid[100];
	void *retv;
	for(int i = 0; i < 100; i++){
		pthread_create(&tid[i], NULL, func, NULL);
		//方式一：在主线程中调
		pthread_detach(tid[i]);
	}


	while(1){
		sleep(1);
	}
}
